LIB_DIR = ..\\lib
BIN_DIR = ..\\bin

#or use a debug build of the .NET dll, if necessary
#  (don't forget, qmake and .NET Release / Debug settings are independent)
NET_BUILD_DIR = $$NET_PROJECT_NAME\\bin\\x86\\Release

#let's kick off incremental builds when the .NET dll changes
PRE_TARGETDEPS += $$NET_BUILD_DIR\\$$NET_PROJECT_NAME.dll

#uncomment this do double check the path, in case of problems
#warning(Building wrapper for a .NET dll: $$NET_BUILD_DIR\\$${NET_PROJECT_NAME}.dll)

#...the necessary build steps will involve:
#  1) exporting the .tlb file (into /lib)
#  2) copying the dll itself alongside the other binaries for the subdirs project tree (into /bin)
#  (the first line is merely a nice way to concatenate the three Windows shell commands)
QMAKE_POST_LINK += "echo =============== Exporting .tlb for $${NET_PROJECT_NAME} ==============="
QMAKE_POST_LINK += "&& tlbexp $$NET_BUILD_DIR\\$${NET_PROJECT_NAME}.dll /out:$$LIB_DIR\\$${NET_PROJECT_NAME}.tlb"
QMAKE_POST_LINK += "&& copy /Y $$NET_BUILD_DIR\\$${NET_PROJECT_NAME}.dll $$BIN_DIR"

#qmake will be kind enough to generate a dependency on the .tlb file automatically
#  (which means, relying binaries will be rebuilt upon .tlb change)

#let's not forget the respective clean steps
QMAKE_CLEAN += $$LIB_DIR\\$${NET_PROJECT_NAME}.tlb
QMAKE_CLEAN += $$BIN_DIR\\$${NET_PROJECT_NAME}.dll
